package com.shengqi.xinnongren.work.ui.user.presenter;

import com.shengqi.xinnongren.common.base.BasePresenter;
import com.shengqi.xinnongren.common.config.network.Constants;
import com.shengqi.xinnongren.common.config.network.RetrofitHelper;
import com.shengqi.xinnongren.work.ui.user.view.SettingView;

import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * Created by LuoYaWei on 2018/6/25.
 */
public class SettingPresenter extends BasePresenter<SettingView> {
    public void getAboutUsData() {
        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), Constants.getJsonData(null, null).toString());
        addTask(RetrofitHelper.getInstance().getService().getAboutUsData(requestBody), respond -> {
            if (respond.result == 1) {
                getView().showAboutUsData(respond.data);
            } else
                getView().onRequestFailed(respond.message);
        });
    }

    public void getVersionIntroduction() {
        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), Constants.getJsonData(null, null).toString());
        addTask(RetrofitHelper.getInstance().getService().getVersionIntroduction(requestBody), respond -> {
            if (respond.result == 1) {
                getView().showVersionIntroductionData(respond.data);
            } else
                getView().onRequestFailed(respond.message);
        });
    }
}
